import request from '@/utils/request';

// 会员折扣策略管理相关接口

// 获取折扣策略列表
export function getMemberDiscountList(params) {
  return request({
    url: '/backend/memberDiscount/getList',
    method: 'get',
    params
  });
}

// 获取折扣策略详情
export function getMemberDiscountDetail(id) {
  return request({
    url: `/backend/memberDiscount/getDetail`,
    method: 'get',
    params: {
      id
    }
  });
}

// 新增折扣策略
export function createMemberDiscount(data) {
  return request({
    url: '/backend/memberDiscount/create',
    method: 'post',
    data
  });
}

// 更新折扣策略
export function updateMemberDiscount(id, data) {
  return request({
    url: `/backend/memberDiscount/update`,
    method: 'put',
    data: {
      id,
      ...data
    }
  });
}

// 删除折扣策略
export function deleteMemberDiscount(id) {
  return request({
    url: `/backend/memberDiscount/delete`,
    method: 'delete',
    data: {
      id
    }
  });
}

// 切换折扣策略状态（启用/禁用）
export function toggleMemberDiscountStatus(id, isEnabled) {
  return request({
    url: `/backend/memberDiscount/toggleStatus`,
    method: 'put',
    data: {
      id,
      isEnabled
    }
  });
}

// 批量删除折扣策略
export function batchDeleteMemberDiscount(ids) {
  return request({
    url: '/backend/memberDiscount/batchDelete',
    method: 'delete',
    data: {
      ids
    }
  });
}

// 获取折扣策略统计信息
export function getMemberDiscountStats() {
  return request({
    url: '/backend/memberDiscount/getStats',
    method: 'get'
  });
}

